package com.zhx.experiment.service;

import com.zhx.experiment.entity.Blog;
import com.zhx.experiment.mapper.BlogMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BlogService {
    @Autowired
    BlogMapper blogMapper;

    public void addBlog(Blog blog){
        blogMapper.insertBlog(blog);
    }

    //查询所有Blog
    public List<Blog> findAllBlog() {
        return blogMapper.findAll();
    }

    //根据name删除Blog
    public void deleteBlogByName(String title) {
        blogMapper.deleteBlog(title);
    }

    //根据name查询Blog
    public Blog queryBlogByName(String title) {
        return blogMapper.queryBlog(title);
    }

    //修改Blog
    public void updateBlog(Blog blog) {
        blogMapper.updateBlog(blog);
    }
}
